home *** CD-ROM | disk | FTP | other *** search
/ Chip 2011 November / CHIP_2011_11.iso / Programy / Narzedzia / WebsiteX5 / wsx5_free.exe / {app} / Res / textonly_imemail.inc.php < prev    next >
Encoding:
PHP Script  |  2011-08-17  |  1.4 KB  |  68 lines

  1. <?php
  2.   //Incomedia WebSite X5 EMail Class. All rights reserved.
  3.  
  4.     class imEMail {
  5.         var $from;
  6.         var $to;
  7.         var $subject;
  8.         var $charset;
  9.         var $text;
  10.         var $html;
  11.         
  12.         var $attachments;
  13.         
  14.         function imEMail($from,$to,$subject,$charset) {
  15.             $this->from = $from;
  16.             $this->to = $to;
  17.             $this->subject = $subject;
  18.             $this->charset = $charset;
  19.         }
  20.         
  21.         function setFrom($from) {
  22.             $this->from = $from;
  23.         }
  24.         
  25.         function setTo($to) {
  26.             $this->to = $to;
  27.         }
  28.         
  29.         function setSubject($subject) {
  30.             $this->subject = $subject;
  31.         }
  32.         
  33.         function setCharset($charset) {
  34.             $this->charset = $charset;
  35.         }
  36.         
  37.         function setText($text) {
  38.             $this->text = $text;
  39.         }
  40.         
  41.         function setHTML($html) {
  42.             $this->html = $html;
  43.         }
  44.         
  45.         function attachFile($name,$content,$mime_type) {
  46.             $attachment['name'] = $name;
  47.             $attachment['content'] = base64_encode($content);
  48.             $attachment['mime_type'] = $mime_type;
  49.             $this->attachments[] = $attachment;
  50.         }
  51.         
  52.         function send() {
  53.             $headers = "";
  54.             $msg = "";
  55.  
  56.             if($this->from == "" || $this->to == "" || ($this->text == "" && $this->html == ""))
  57.                 return false;
  58.             
  59.             $headers .= "From: " . $this->from . "\r\n";
  60.             $headers .= "Content-Type: text/plain;charset=" . $this->charset . "\r\n";
  61.             $msg .= $this->text . "\r\n\r\n";
  62.  
  63.             $r = @mail($this->to, $this->subject, $msg, $headers);
  64.             return $r;
  65.         }
  66.     }
  67.  
  68. // End of file imemail.inc.php